<!-- 构造函数 销毁 -->

<script src="vue.js"></script>

<div id="app">
    <div ref="div">需要销毁的控件</div>
</div>

<script>
    var vue = new Vue({
        el: "#app",
        data: {
            msg: 23,
        },
        destroyed() {
            console.log("销毁之后的方法：");
            console.log(this.$refs.div);
            console.log(this.$data.msg);
            console.log(vue);
        },
        beforeDestroy() {
            console.log("销毁之前的方法：");
            console.log(this.$refs.div);
            console.log(this.$data.msg);
            console.log(vue);
        }
    })
</script>